package com.ruoyi.yanjing.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yanjing.mapper.TrainingsMapper;
import com.ruoyi.yanjing.domain.Trainings;
import com.ruoyi.yanjing.service.ITrainingsService;

/**
 * 培训信息Service业务层处理
 * 
 * @author whz
 * @date 2024-12-04
 */
@Service
public class TrainingsServiceImpl implements ITrainingsService 
{
    @Autowired
    private TrainingsMapper trainingsMapper;

    /**
     * 查询培训信息
     * 
     * @param id 培训信息主键
     * @return 培训信息
     */
    @Override
    public Trainings selectTrainingsById(Long id)
    {
        return trainingsMapper.selectTrainingsById(id);
    }

    /**
     * 查询培训信息列表
     * 
     * @param trainings 培训信息
     * @return 培训信息
     */
    @Override
    public List<Trainings> selectTrainingsList(Trainings trainings)
    {
        return trainingsMapper.selectTrainingsList(trainings);
    }

    /**
     * 新增培训信息
     * 
     * @param trainings 培训信息
     * @return 结果
     */
    @Override
    public int insertTrainings(Trainings trainings)
    {
        trainings.setCreateTime(DateUtils.getNowDate());
        return trainingsMapper.insertTrainings(trainings);
    }

    /**
     * 修改培训信息
     * 
     * @param trainings 培训信息
     * @return 结果
     */
    @Override
    public int updateTrainings(Trainings trainings)
    {
        trainings.setUpdateTime(DateUtils.getNowDate());
        return trainingsMapper.updateTrainings(trainings);
    }

    /**
     * 批量删除培训信息
     * 
     * @param ids 需要删除的培训信息主键
     * @return 结果
     */
    @Override
    public int deleteTrainingsByIds(Long[] ids)
    {
        return trainingsMapper.deleteTrainingsByIds(ids);
    }

    /**
     * 删除培训信息信息
     * 
     * @param id 培训信息主键
     * @return 结果
     */
    @Override
    public int deleteTrainingsById(Long id)
    {
        return trainingsMapper.deleteTrainingsById(id);
    }
}
